<?php


namespace App\Service;


use Illuminate\Support\Facades\Cache;

class Phone
{
    public function sendSms($mobile)
    {
        $smsapi = "http://api.smsbao.com/";
        $user = "lzc7758521"; //短信平台帐号
        $pass = md5("asd7758521"); //短信平台密码
        $code = rand(1000,9999);
        $content = "您的验证码为".$code."该验证码五分钟内有效，请勿泄露给他人";//要发送的短信内容
        $phone = $mobile;//要发送短信的手机号码
        $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
        Cache::put($phone.'_code',$code);
        //$result =file_get_contents($sendurl) ;
        return $code;
    }

}
